package com.abou.connector.dao;

import java.util.List;
import com.abou.constant.product.EClotheType;
import com.abou.constant.product.EProductType;
import com.abou.constant.product.ESortOrder;
import com.abou.model.common.product.Product;

/**
 * The DAO used to manage the product entities.
 * 
 * @author khalid
 */
public interface IProductDao extends IGenericDao<Product> {
  
  /**
   * @param sortOrder The sort order
   * @param pageIndex The page index
   * @param pageSize The page size
   * @return All the product in database.
   */
  List<Product> findAllProducts(ESortOrder sortOrder, int pageIndex,
      int pageSize);
  
  /**
   * @return Total rows number.
   */
  int findAllProducts();
  
  /**
   * Returns all the products for the passed params.
   * 
   * @param name A name identifier.
   * @param description A product description identifier.
   * @param type A type identifier.
   * @param sortOrder The sort order
   * @param pageIndex The page index
   * @param pageSize The page size
   * @return A products list
   */
  List<Product> findProducts(String name, String description,
      EProductType type, ESortOrder sortOrder, int pageIndex, int pageSize);
  
  /**
   * Returns all the products for the passed params.
   * 
   * @param name The name identifier.
   * @param description The product description identifier.
   * @param productType The product type
   * @param clotheType The clothes type
   * @param sortOrder The sort order
   * @param pageIndex The page index
   * @param pageSize The page size
   * @return A products list
   */
  List<Product> findProductsClothes(String name, String description,
      EProductType productType, EClotheType clotheType, ESortOrder sortOrder,
      int pageIndex, int pageSize);
  
  /**
   * Returns the number products for the passed params.
   * 
   * @param name The name identifier.
   * @param description The product description identifier.
   * @param productType The product type
   * @param clotheType The clothes type
   * @return Total rows number.
   */
  int findProductsClothes(String name, String description,
      EProductType productType, EClotheType clotheType);
  
  /**
   * Returns all the products for the passed params.
   * 
   * @param name The name identifier.
   * @param description The product description identifier.
   * @param productType The product type
   * @param clotheType The clothes type
   * @param sortOrder The sort order
   * @param pageIndex The page index
   * @param pageSize The page size
   * @return A products list
   */
  List<Product> findProductsClothesNoClotheType(String name,
      String description, EProductType productType, ESortOrder sortOrder,
      int pageIndex, int pageSize);
  
  /**
   * Returns the number products for the passed params.
   * 
   * @param name The name identifier.
   * @param description The product description identifier.
   * @param productType The product type
   * @return Total rows number.
   */
  int findProductsClothesNoClotheType(String name, String description,
      EProductType productType);
  
  /**
   * Returns all the products for the passed params.
   * 
   * @param name A name identifier.
   * @param description A product description identifier.
   * @param sortOrder The sort order
   * @param pageIndex The page index
   * @param pageSize The page size
   * @return A products list
   */
  List<Product> findProductsByNameDescription(String name, String description,
      ESortOrder sortOrder, int pageIndex, int pageSize);
  
  /**
   * Returns the number products for the passed params.
   * 
   * @param name A name identifier.
   * @param description A product description identifier.
   * @return Total rows number.
   */
  int findProductsByNameDescription(String name, String description);
  
  /**
   * Returns all the products for the passed params.
   * 
   * @param name A name identifier.
   * @param description A product description identifier.
   * @param type A type identifier.
   * @return Total rows number.
   */
  int findProducts(String name, String description, EProductType type);
  
  /**
   * Returns all the products for the passed params.
   * 
   * @param name A name identifier.
   * @param sortOrder The sort order
   * @param pageIndex The page index
   * @param pageSize The page size
   * @return A products list
   */
  List<Product> findProductByName(String name, ESortOrder sortOrder,
      int pageIndex, int pageSize);
  
  /**
   * Returns the number products for the passed params.
   * 
   * @param name A name identifier.
   * @return Total rows number.
   */
  int findProductByName(String name);
  
  /**
   * Returns all the products for the passed description.
   * 
   * @param description A product description identifier.
   * @param sortOrder The sort order
   * @param pageIndex The page index
   * @param pageSize The page size
   * @return A products list
   */
  List<Product> findProductByDescription(String description,
      ESortOrder sortOrder, int pageIndex, int pageSize);
  
  /**
   * Returns all the products for the passed description.
   * 
   * @param description A product description identifier.
   * @return Total rows number.
   */
  int findProductByDescription(String description);
  
  /**
   * Returns all the products for the passed type.
   * 
   * @param type A type identifier.
   * @param sortOrder The sort order
   * @param pageIndex The page index
   * @param pageSize The page size
   * @return A products list
   */
  List<Product> findProductByType(EProductType type, ESortOrder sortOrder,
      int pageIndex, int pageSize);
  
  /**
   * Returns the number products for the passed type.
   * 
   * @param type A type identifier.
   * @return Total rows number.
   */
  int findProductByType(EProductType type);
}